package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 结算明细
 * </p>
 *
 * @author linan
 * @date 2023-05-25
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionSettlementDetailSettlementTypeEnum", description = "结算类型 #{SERVICE:服务;WORK_OVERTIME:加班;REPAIR_REPORT:报修;MANAGE:管理费-枚举")
public enum ExhibitionSettlementDetailSettlementTypeEnum implements BaseEnum {

    /**
     * SERVICE="服务"
     */
    SERVICE("服务"),
    /**
     * WORK_OVERTIME="加班"
     */
    WORK_OVERTIME("加班"),
    /**
     * REPAIR_REPORT="报修"
     */
    REPAIR_REPORT("报修"),
    /**
     * MANAGE="管理费"
     */
    MANAGE("管理费"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionSettlementDetailSettlementTypeEnum match(String val, ExhibitionSettlementDetailSettlementTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionSettlementDetailSettlementTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionSettlementDetailSettlementTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SERVICE,WORK_OVERTIME,REPAIR_REPORT,MANAGE", example = "SERVICE")
    public String getCode() {
        return this.name();
    }

}
